package cn.java75.sp.util;

import io.jsonwebtoken.Claims;

import java.util.Arrays;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class JWTest {
    public static void main(String[] args) {
        Users user=new Users("laoliu","123456","13858482828");
        List<Object> roles= Arrays.asList("updateUser","delUser","delDept","delCustomer");
        String to = JwtUtil.createToken("laowu", roles, user);
        System.out.println(to);
        String token=to;
        System.out.println(JwtUtil.getUserName(token));
        Claims cms = JwtUtil.getTokenBody(token);
        System.out.println(cms.getId()+">>>>");
        System.out.println(cms);
        System.out.println();
        System.out.println(cms.getSubject());
        System.out.println(cms.get(JwtUtil.FUNCTS));
        System.out.println(cms.get(JwtUtil.USERINFO));
        System.out.println(JwtUtil.getUser(token));

    }
}
